module shifter_ref #(
    parameter integer SHAMT_WIDTH = 5
) (
    input [2**SHAMT_WIDTH-1:0] dat_i,
    input [SHAMT_WIDTH-1:0]    shamt_i,
    input  shdir_i,
    input  sharith_i,
    output reg [2**SHAMT_WIDTH-1:0] dat_o
);

always @(*) begin
    dat_o = dat_i;
    if (~shdir_i) begin
        dat_o = {dat_i << shamt_i};
    end else if (~sharith_i) begin
        dat_o = {dat_i >> shamt_i};
    end else begin
        dat_o = {$signed(dat_i) >>> shamt_i};
    end
end

endmodule
